package com.gable.exhibition.dao;

import com.gable.common.util.ReturnResultUtil;
import com.gable.exhibition.model.SysUrl;
import com.gable.exhibition.model.User;
import com.gable.exhibition.view.UserView;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserDao {
    int deleteByPrimaryKey(Long userId);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long userId);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * 用户登录
     * @param userName
     * @Create user jacky
     * @Create date 2018/2/5
     * @return
     */
    UserView loginUser(String userName);

    /**
     * 用户登录
     * @param openId
     * @Create user jacky
     * @Create date 2018/2/5
     * @return
     */
    UserView loginUserByOpenId(String openId);

    /**
     * 修改密码
     * @return
     */
    int updatePassword(User userView);

    /**
     * 获取用户总数，用于分页
     * @param userView
     * @Create user jacky
     * @Create date 2018/2/6
     * @return
     */
    int queryUserCount(UserView userView);

    /**
     * 获取用户列表，分页
     * @param userView
     * @Create user jacky
     * @Create date 2018/2/6
     * @return
     */
    List<UserView> queryUserList(UserView userView);

    /**
     * 判断用户名是否存在
     * @param userView  (userName,userId)
     * @Create user jacky
     * @Create date 2018/2/6
     * @return
     */
    int checkUserExitis(UserView userView);

    /**
     * 获取用户详情
     * @param userId
     * @Create user jacky
     * @Create date 2018/2/6
     * @return
     */
    UserView queryUserInfo(Long userId);

    /**
     * 查询用户信息
     * @param userView
     * @return
     */
    User queryUser(UserView userView);

    /**
     * 根据流程数据中的工程师电话号码判断用户是否存在
     * @return
     * @Create user jacky
     * @Create date 2018/3/1
     */
    User checkUserByEngineerPhone(User user);

    List<String> queryUserListByTag(UserView userView);

    List<User> queryUserNameList();
    int updateUserPinYinName(User user);

    /**
     * 校验手机号是否存在
     * @param userView
     * @Create user jacky
     * @Create date 2018/3/10
     * @return
     */
    int checkUserMobileExitis(UserView userView);

    /**
     * 查询各种角色管理员的电话
     * @param userView
     * @return
     */
    List<String> getUsersMobile(UserView userView);

    /**
     * 修改OpenId
     * @return
     */
    int updateOpenId(User userView);

    /**
     * 解除绑定
     * @param userView
     */
    void updateOpenIdNull(UserView userView);

    /**
     * 根据用户id 删除用户和菜单的关联关系
     * @Create user jacky
     * @Create date 2019/7/23
     * @param userId
     * @return
     */
    int deleteMenuByUserId(@Param("userId") Long userId);

    /**
     * 插入用户和菜单之间的关系
     * @Create user jacky
     * @Create date 2019/7/23
     * @return
     */
    int insertUserMenu(@Param("userId") Long userId,@Param("urlId") Long urlId);

    /**
     * 获取登录用户的菜单权限
     * @param userId
     * @return
     */
    List<SysUrl> querySysUserByLoginUser(@Param("userId") Long userId);

}